<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE HTML>
<html>
<head>
  <title>后台管理系统</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link href="/resources/css/dpl-min.css" rel="stylesheet" type="text/css" />
  <link href="/resources/css/bui-min.css" rel="stylesheet" type="text/css" />
  <link href="/resources/css/page-min.css" rel="stylesheet" type="text/css" />
</head>
<body>

<div class="container">

  <form id="searchForm" class="form-horizontal">
      <input type="hidden" name="index" value="${index}"/>
      <input type="hidden" name="startDate" value="${startDate}"/>
      <input type="hidden" name="endDate" value="${endDate}"/>
      <input type="hidden" name="province" value="${province}"/>
      <input type="hidden" name="city" value="${city}"/>
      <input type="hidden" name="area" value="${area}"/>
      <a href="javascript:void(0);" onclick="back()">返回</a>
  </form>

  <div class="search-grid-container">
    <div id="grid"></div>
  </div>
</div>

<script type="text/javascript" src="/resources/js/jquery-1.8.1.min.js"></script>
<script type="text/javascript" src="/resources/js/bui-min.js"></script>
<script type="text/javascript" src="/resources/js/config-min.js"></script>
<script type="text/javascript">
    var store,gridCfg;
    var del_url = "/admin/updateStatus";
  BUI.use(['common/search','common/page','bui/grid','bui/overlay','bui/form'],function (Search,Page,Grid,Overlay,Form) {
    var  columns = [
              {title:'订单号',dataIndex:'no',width:150},
              {title:'下单人',dataIndex:'userName',width:150},
              {title:'联系电话',dataIndex:'telephone',width:120},
              {title:'订单金额',dataIndex:'totalMoney',width:120},
              {title:'下单时间',dataIndex:'dateStr',width:150},
              {title:'返现总额',dataIndex:'remark',width:120,renderer:function(value,obj){
                    return "<a href='javascript:void(0);' onclick=\"showCnt('"+obj.id+"')\">"+obj.remark+"</a>";
              }}
            ];
            store = Search.createStore('/orderFx/listData');
            gridCfg = Search.createGridCfg(columns,{
              plugins : [BUI.Grid.Plugins.CheckSelection] // 插件形式引入多选表格
            });
  });

    var Overlay = BUI.Overlay
    var dialog = new Overlay.Dialog({
        title:'返现记录',
        width:650,
        height:350,
        contentId:'content',
        success:function () {
            dialog.hide();
        }
    });

    function showCnt(id){
        $.ajax({
            url:"/orderFx/loadDetails?ran="+Math.random(),
            type:"post",
            data:{
                id:id
            },
            success:function(res){
                if(res.success){
                    var html = "";
                    if(res.data!=null&&res.data.length>0){
                        $.each(res.data,function(i,n){
                            html += "<tr  class=\"bui-grid-row bui-grid-row-odd\">";
                            html += "<td class=\"bui-grid-cell grid-td-col1\" style=\"width:100px;\"><div class=\"bui-grid-cell-inner\"><span class=\"bui-grid-cell-text \">"+n.nickName+"</span></div></td>";
                            html += "<td class=\"bui-grid-cell grid-td-col2\" style=\"width:103px;\"><div class=\"bui-grid-cell-inner\"><span class=\"bui-grid-cell-text \">"+n.userName+"</span></div></td>";
                            var type = "";
                            if(n.userType=='Customer'){
                                type = "普通用户";
                            }else if(n.userType=='Gold'){
                                type = "金牌代理";
                            }else if(n.userType=='General'){
                                type = "全国总代";
                            }else if(n.userType=='Partner'){
                                type = "区域合伙人";
                            }
                            html += "<td class=\"bui-grid-cell grid-td-col3\" style=\"width:103px;\"><span class=\"bui-grid-cell-text \">"+type+"</span></div></td>";
                            html += "<td class=\"bui-grid-cell grid-td-col4\" style=\"width:103px;\"><span class=\"bui-grid-cell-text \">"+n.amount+"</span></div></td>";
                            html += "<td class=\"bui-grid-cell grid-td-col5\" style=\"width:120px;\"><span class=\"bui-grid-cell-text \">"+n.dateStr+"</span></div></td>";
                            html += "</tr>";
                        });

                    }else{
                        html  = "<tr><td colspan='5' style=\"align:center;\">暂无记录</td></tr>";
                    }
                    $("#table_info").html(html);
                    dialog.show();
                }
            },
            error:function(){}
        });
    }
</script>
<script type="text/javascript" src="/views/js/list.js"></script>
<div id="content"  style="display:none;">

    <div class="bui-grid bui-simple-list bui-grid-width bui-grid-border bui-grid-strip" style="width: 99%;" aria-disabled="false" aria-pressed="false">
        <div class="bui-grid-header-container">
            <div class="bui-grid-header" style="width: 98%;margin-left:10px;" aria-disabled="false" aria-pressed="false">
                <table cellspacing="0" cellpadding="0" class="bui-grid-table">
                    <thead>
                    <tr>
                        <th class="bui-grid-hd" style="width:100px;" aria-disabled="false" aria-pressed="false">
                            <div class="bui-grid-hd-inner"><span class="bui-grid-hd-title">微信号</span>
                               </div></th>
                        <th class="bui-grid-hd"  style="width:100px;"  aria-disabled="false">
                            <div class="bui-grid-hd-inner"><span class="bui-grid-hd-title">姓名</span></div></th>
                        <th class="bui-grid-hd"  style="width:100px;" aria-disabled="false">
                            <div class="bui-grid-hd-inner"><span class="bui-grid-hd-title">用户级别</span></div></th>
                        <th class="bui-grid-hd"  style="width:100px;" aria-disabled="false">
                            <div class="bui-grid-hd-inner"><span class="bui-grid-hd-title">返现金额</span></div></th>
                        <th class="bui-grid-hd"  style="width:120px;" aria-disabled="false"><div class="bui-grid-hd-inner">
                            <span class="bui-grid-hd-title">返现时间</span></div></th>
                    </tr>
                    </thead>
                </table>
            </div>
        </div>


        <div class="bui-grid-body" style="width: 98%;margin-left:10px;">
            <table cellspacing="0" cellpadding="0" class="bui-grid-table" style="width: 98%;">
            <tbody id="table_info">

            </tbody></table>
        </div></div></div></div>
</div>

<script type="text/javascript">
    function back(){
        top.topManager.openPage({
            id : 'jy',
            isClose : true
        });
    }
</script>
</body>
</html>  
